<template>
  <div>
    <form>
      <label>姓名：</label>
      <input type="text" v-model="name"><br><br>

        <label>年龄：</label>
        <input type="number" v-model.number="age"><br><br>

          <label>身高：</label>
          <input type="number" v-model.number="height">(米)<br><br>

            <label>体重：</label>
            <input type="number" v-model.number="weight">(公斤)<br><br>

              <label>病史：</label>
              <input type="text" v-model="history"><br><br>

                <button @click.prevent="submitFn">诊断</button>
              </form>

    <p>患者{{name}}的诊断结果:{{healthy===true? "健康":"不健康"}} </p>
  </div>
</template>

<script>
  export default {
    data () {
      return {
       name:"",
       age:"",
       height:"",
       weight:"",
       history:"",
       healthy:""
      }
    },
    methods: {
      submitFn(){
      
       let BMI = this.weight/this.height**2
        // console.log(BMI);
        if(BMI<=24){
          this.healthy=true;
        }else{
          this.healthy=false;
        }
      }
    }
  }
</script>

export default {
    props: {

    },
    data() {
        return {

        };
    },
    computed: {

    },
    created() {

    },
    mounted() {

    },
    watch: {

    },
    methods: {

    },
    components: {

    },
};
</script>

<style scoped lang="scss">

</style>

